import { IArticleUploadReq } from '@/api/admin/article/type';
import { IArticleRes } from '@/api/article/type';
import { http } from '@/core/http';

/**
 * 查询个人文章列表
 * @param params
 */
export const personalArticleList = (params?: {
    pageSize?: number;
    pageNum?: number;
}) => {
  return http.get<IArticleRes>({
    url: 'article/personal/list',
    isLoading: false,
    params
  });
};
/**
 * 删除个人文章
 * @param uid
 */
export const personalArticleDeleteByOne = (uid: string) => {
  return http.delete({
    url: `article/personal/delete/${uid}`,
    isShowSuccessText: true
  });
};
/**
 * 更新是否公开
 * @param data
 */
export const articleUpdatePubic = (data: {
    uid: string;
    public: 1 | 0;
}) => {
  return http.put({
    url: 'article/update/public',
    isShowSuccessText: true,
    data
  });
};
/**
 * 上传文章
 * @param data
 */
export const articleUpload = (data: IArticleUploadReq) => {
  return http.post({
    url: 'article/upload',
    isShowSuccessText: true,
    data
  });
};
/**
 * 更新文章
 * @param data
 */
export const articleUpdate = (data: IArticleUploadReq) => {
  return http.put({
    url: 'article/update',
    isShowSuccessText: true,
    data
  });
};
